class CustomBulletSource < BulletSource



  def initialize(controller, x, y, bulletMLSource)
    super(controller, x, y, bulletMLSource)

    @image        = nil
    @rect         = nil

    @half_width   = 0
    @half_height  = 0

    @bulletImage  = nil
    @bulletRect   = nil

  end



  def setImage(image, rect)

    @image        = image
    @rect         = rect

    @half_width   = @rect[2]/2.0
    @half_height  = @rect[3]/2.0

  end



  def setBulletImage(image, rect)

    @bulletImage  = image
    @bulletRect   = rect

  end



  def addBullet(fireElement, parent, params)

    @liveBullets << CustomBullet.new(fireElement, parent, self, params)
    @liveBullets.last.setImage(@bulletImage, @bulletRect)

  end



  def draw

    @image.blit(@controller.screen, [@x-@half_width,@y-@half_height], @rect)

    super

  end

end